clear
infix nep 2-5 totdays 7-11 incloan 13-17 decloan 19-23 maxchgloan 25-33 minchgloan 35-43 avgchgloan 45-53 retinc 55-63 retdec 65-73 incloan2 75-79 retinc2 81-89 decloan2 91-95 retdec2 97-105 incloan5 107-111 retinc5 113-121 decloan5 123-127 retdec5 129-137 ctlpos 139-143 retlpos 145-153 ctlpos2 155-159 retlpos2 161-169 ctlpos5 171-175 retlpos5 177-185 turnpos 187-195 turn2pos 197-205 turnneg 207-215 turn2neg 217-225 turnlpos 227-235 turn2lpos 237-245 retsdpos 247-255 retsdneg 257-265 retsdlpos 267-275 using "e:\FIS_duration\ret_aft_shortsale_rep.txt"
log using "E:\FIS_duration\rets_turn_after_lg_shortsale_rep.log"
gen pctinc = incloan/totdays
gen pctdec = decloan/totdays
summarize pctinc pctdec maxchgloan minchgloan avgchgloan, detail
summarize retinc if incloan > 0, detail
summarize retdec if decloan > 0, detail
summarize retinc2 if incloan2 > 0, detail
summarize retdec2 if decloan2 > 0, detail
summarize retinc5 if incloan5 > 0, detail
summarize retdec5 if decloan5 > 0, detail
summarize retlpos if ctlpos > 0, detail
summarize retlpos2 if ctlpos2 > 0, detail
summarize retlpos5 if ctlpos5 > 0, detail
summarize turnpos turn2pos if incloan > 0, detail
summarize turnneg turn2neg if decloan > 0, detail
summarize turnlpos turn2lpos if ctlpos > 0, detail
gen retdif = retinc-retdec
summarize retdif if incloan > 0 & decloan > 0
summarize retdif if incloan > 0 & decloan > 0, detail
ttest retdif == 0 if incloan > 0 & decloan > 0
gen retdif2 = retinc2-retdec2
ttest retdif2 == 0 if incloan2 > 0 & decloan2 > 0
gen retdif5 = retinc5-retdec5
ttest retdif5 == 0 if incloan5 > 0 & decloan5 > 0
gen retsddif = retsdpos - retsdneg
ttest retsddif = 0 if incloan > 0 & decloan > 0
ttest retinc == 0 if incloan > 0
ttest retdec == 0 if decloan > 0
ttest retinc2 == 0 if incloan2 > 0
ttest retdec2 == 0 if decloan2 > 0
ttest retinc5 == 0 if incloan5 > 0
ttest retdec5 == 0 if decloan5 > 0
ttest retlpos == 0 if ctlpos > 0
ttest retlpos2 == 0 if ctlpos2 > 0
ttest retlpos5 == 0 if ctlpos5 > 0
ttest retsdpos == 0 if incloan > 0
ttest retsdneg == 0 if decloan > 0
ttest retsdlpos == 0 if ctlpos > 0
log close